package user;

import operation.*;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2022-04-14
 * Time: 14:04
 */
public class AdminUser extends User{

    public AdminUser(String name) {
       this.name = name;
       this.dooperation = new Operation[] {
               new ExitOperation(),
               new SearchOperation(),
               new AddOperation(),
               new DeleteOperation(),
               new DisplayOperation()
       };
    }


    @Override
    public int  menu() {
        System.out.println("========= 管理员菜单 =========");
        System.out.println("1.查找书籍");
        System.out.println("2.添加书籍");
        System.out.println("3.删除书籍");
        System.out.println("4.显示书籍");
        System.out.println("0.退出系统");
        System.out.println("请选择：");
        Scanner scan = new Scanner(System.in);
        while (true) {
            int choice = scan.nextInt();
            if(choice >=0 && choice<=4) {
                return choice;
            } else {
                System.out.println("输入错误，请重新输入");
            }
        }

    }
}
